Skip to main content

resfile

Type

keyword

Summary

Used as a URL type with such commands as load and get to designate the resource fork of a Mac OS file.

Syntax

resfile

Description

Use the resfile keyword to work with Mac OS resource forks.

On Mac OS systems, files consist of either or both of a data fork and a resource fork. The resource fork contains defined resources such as icons, menu definitions, dialog boxes, fonts, and so forth.

A URL container can be used anywhere another container type is used. The LiveCode-specific scheme "resfile" indicates the resource fork of a file which is located on the user's system. The file is specified by either an absolute path starting with "/", or a relative path from the defaultFolder.

A resfile URL specifies the entire resource fork, not just one resource. The most common use for this URL scheme is to copy an entire resource fork from one file to another. To modify the data from a resfile URL, you need to understand the details of Apple's resource fork format and its relationship with the data fork.

    put empty into URL \"file:myFile\" -- creates an empty file

put myStoredResources into URL "resfile:myFile"

Important

Unlike the file and binfile URL types, the resfile keyword cannot be used to create a file. If the file "myFile" doesn't yet exist, attempting to use it with the resfile keyword will fail and the result function will be set to "file not found". To create a new resource file, first use a file URL to create the file with an empty data fork, then write the needed data to its resource fork.

Examples

get URL "resfile:/Disk/System Folder/Apple Menu Items/Calculator App"
put tResForkData into URL "resfile:MyFile"

command: get, load, revCopyFile

control structure: function

function: result, setResource

glossary: keyword, resource fork, resource, Mac OS, URL scheme, data fork

keyword: URL, file, binfile, resfile

Compatibility and Support

Introduced

LiveCode 1.0

OS

mac

Platforms

desktop

server

Thank you for your feedback!

Was this page helpful?